package cc.vv.btpartyjob.partymanager.delegate

import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 单位报到新增资源托管类
 * Created by Chen.qi on 2018/10/27.
 */
class AddResourceActivityDelegate : BaseAppDelegate() {

    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_add_resource_info
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_aar_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_aar_topBar)
        titleBar?.setEventInterface(event)
    }

    /**
     * 设置时间
     */
    fun setDataTime(dataStr: String) {
        getView<TextView>(R.id.tv_aar_createData)?.text = dataStr
    }


    /**
     * 设置时间
     */
    fun setEndTime(entTime: String) {
        getView<TextView>(R.id.tv_aar_endTime)?.text = entTime
    }


    /**
     * 设置方式
     */
    fun setChooseWay(wayStr: String) {
        getView<TextView>(R.id.tv_aar_supplyWay)?.text = wayStr
    }

    fun getContentStr(): String {
        val conView = getView<TextView>(R.id.et_aar_projectContent)
        return conView?.text.toString().trim()
    }


    /**
     * 金额输入是否显示
     */
    fun showInputMoney(isShow: Boolean) {
        val viewMon = getView<LinearLayout>(R.id.ll_input_money)
        if (isShow) {
            viewMon?.visibility = View.VISIBLE
        } else {
            viewMon?.visibility = View.GONE
        }
    }

    /**
     * 获取金额
     */
    fun getMoney(): String {
        val viewMon = getView<TextView>(R.id.et_aar_inputMoney)
        return viewMon?.text.toString().trim()
    }

    /**
     * 获取品类
     */
    fun getPinglei(): String {
        val viewPinlei = getView<TextView>(R.id.et_aar_ziYuanPinlei)
        return viewPinlei?.text.toString().trim()
    }

}